<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		
	</body>
</html>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		 <img src="img/1.jpg" >
		 <button type="button" onclick="changes()">切换</button>
	</body>
	<script type="text/javascript">
		var arr=["img/1.jpg","img/2.jpg","img/3.jpg","img/4.jpg","img/5.jpg","img/6.jpg","img/7.jpg","img/.jpg","img/9.jpg"];
		var img=document.getElementsByTagName("img")[0];
		var index=0;
		var num =0;
		function changes(){
		num++;
		if(num>0){
		    var times=setInterval(function(){
		    index++;
		   if(index>arr.length-1){
		       index=0;
		   }
		    img.src=arr[index];
		    
		    },1000);
		}
		}
	</script>
</html>
